<!--
 * @Author: ytf
 * @Date: 2020-11-08 22:38:58
 * @LastEditTime: 2020-11-24 13:30:40
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \mi_mall\src\pages\alipay.vue
-->
<template>
  <div class="alipay">
    <Loading v-if="Loading" />
    <div class="form" v-html="content"></div>
  </div>
</template>

<script>
import Loading from '@/components/Loading'
export default {
  name: 'order-alipay',
  data() {
    return {
      orderId: this.$route.query.orderId,
      content: '',
      Loading: true,
    }
  },
  components: {
    Loading,
  },
  mounted() {
    this.paySubmit()
  },
  methods: {
    paySubmit() {
      this.axios
        .post('/pay', {
          orderId: this.orderId,
          orderName: 'vue小米',
          amount: 0.01,
          payType: 1,
        })
        .then((res) => {
          console.log(res)
          this.content = res.content
          setTimeout(() => {
            document.forms[0].submit()
          }, 100)
        })
    },
  },
}
</script>

<style></style>
